/***************************** BEGIN LICENSE BLOCK ***************************

 The contents of this file are subject to the Mozilla Public License Version
 1.1 (the "License"); you may not use this file except in compliance with
 the License. You may obtain a copy of the License at
 http://www.mozilla.org/MPL/MPL-1.1.html
 
 Software distributed under the License is distributed on an "AS IS" basis,
 WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 for the specific language governing rights and limitations under the License.
 
 The Original Code is the "EO-SPS Framework".
 
 The Initial Developer of the Original Code is Spotimage S.A.
 Portions created by the Initial Developer are Copyright (C) 2007
 the Initial Developer. All Rights Reserved.
 
 Contributor(s): 
    Alexandre Robin <alexandre.robin@spotimage.fr>
 
******************************* END LICENSE BLOCK ***************************/

package com.spotimage.eosps;

import org.vast.cdm.common.DataComponent;
import org.vast.data.DataValue;
import org.vast.ows.sps.TaskingRequest;


/**
 * <p><b>Title:</b><br/>
 * EO Radar Param Helper
 * </p>
 *
 * <p><b>Description:</b><br/>
 * This class is a helper to get and set tasking parameters
 * that are specific to SAR earth observation instruments.
 * It must be constructed from an existing GetFeasibility
 * or Submit request (for instance as obtained using the
 * generic SPS deserializers).
 * </p>
 *
 * <p>Copyright (c) 2008, Spot Image</p>
 * @author Alexandre Robin <alexandre.robin@spotimage.fr>
 * @date July, 10th 2008
 * @since 1.0
 */
public class EORadarParamHelper extends EOParamHelper implements EORadarConstants
{
	
	public EORadarParamHelper(TaskingRequest request)
	{
		super(request);
	}
	
	
	public EORadarParamHelper(TaskingRequest request, DataComponent taskingParams)
	{
		super(request, taskingParams);
	}
	
	
	/**
	 * Finds haze accepted field in request parameters structure
	 * @return
	 */
	public DataValue findPolarizationMode()
	{
		DataComponent param = findParameterByDefinition(POLARIZATION_URI);
		return (DataValue)param;
	}
	
	
	public String getPolarizationMode()
	{
		DataComponent param = findPolarizationMode();
		if (param == null)
			return null;
		
		return param.getData().getStringValue();
	}
	
	
	public void setPolarizationMode(String mode)
	{
		DataComponent param = findPolarizationMode();
		if (param != null)
			param.getData().setStringValue(mode);
	}
	
	
	/**
	 * Finds haze accepted field in request parameters structure
	 * @return
	 */
	public DataValue findMaxNoiseLevel()
	{
		DataComponent param = findParameterByDefinition(NOISE_URI);
		return (DataValue)param;
	}
	
	
	public double getMaxNoiseLevel()
	{
		DataComponent param = findMaxNoiseLevel();
		if (param == null)
			return 100.0;
		
		return param.getData().getDoubleValue();
	}
	
	
	public void setMaxNoiseLevel(double maxNoise)
	{
		DataComponent param = findMaxNoiseLevel();
		if (param != null)
			param.getData().setDoubleValue(maxNoise);
	}
	
	
	/**
	 * Finds haze accepted field in request parameters structure
	 * @return
	 */
	public DataValue findMaxAmbiguityLevel()
	{
		DataComponent param = findParameterByDefinition(AMBIGUITY_URI);
		return (DataValue)param;
	}
	
	
	public double getMaxAmbiguityLevel()
	{
		DataComponent param = findMaxAmbiguityLevel();
		if (param == null)
			return 100.0;
		
		return param.getData().getDoubleValue();
	}
	
	
	public void setMaxAmbiguityLevel(double maxAmbiguity)
	{
		DataComponent param = findMaxAmbiguityLevel();
		if (param != null)
			param.getData().setDoubleValue(maxAmbiguity);
	}
}
